<?php

?>

<table width="100%" class="table">
	<tr>
		<th>Jurusan</th>
		<th>Tahun Ajaran</th>
		<th>Semester</th>
		<th>Mulai</th>
		<th>Selesai</th>
		<th>Keterangan</th>
	</tr>
	<tr>
	<td><?php echo $krs_siswa->kode_jurusan;?></td>
	<td><?php echo $krs_siswa->tahun_ajaran;?></td>
	<td><?php echo $krs_siswa->semester;?></td>
	<td><?php echo $krs_siswa->tgl_mulai;?></td>
	<td><?php echo $krs_siswa->tgl_selesai;?></td>
	<td><?php echo $krs_siswa->keterangan;?></td>
	</tr>
	</table>
	
<form action="" method="POST" >
<table width="100%" class="table" style="margin-top:10px;">
	<caption><h2><b>Pilihan Mata Kuliah</b></h2></caption>
	<tr>
		<th></th>
		<th>Kode Mata Kuliah</th>
		<th>Mata Kuliah</th>
		<th>Jumlah Sks</th>
		<th>Syarat Semester</th>
		<th>Syarat Mata Kuliah</th>
		<th>Syarat Jumlah Sks</th>
		<th>Wajib</th>
	</tr>
	<?php
	if($results_mata_kuliah)
	{
		//	kode_mata_kuliah 	kode_jurusan 	jumlah_sks 	syarat_semester 	syarat_mata_kuliah 	syarat_jumlah_sks 	penentuan_mahasisw_manual 	wajib 	id_tahun_ajaran 	id_semester 
		
		$semester_count=($krs_siswa->semester='ganjil')?1:2;
		$semester_siswa=(date('Y')-$model_siswa['tahun_masuk'])*2+$semester_count;
		
		
		foreach($results_mata_kuliah as $row)
		{
			
		$checkbox_krs=($semester_siswa==$row->syarat_semester)?
		'<input type="checkbox" name="id_mata_kuliah_jurusan[]" value="'.$row->id_mata_kuliah_jurusan.'" id="'.$row->id_mata_kuliah_jurusan.'"><label for="'.$row->id_mata_kuliah_jurusan.'"></label>'
		:'';
		?>
		<tr>
		<td><?php echo $checkbox_krs;?></td>
		<td><?php echo $row->kode_mata_kuliah;?></td>
		<td><?php echo $row->nama_mata_kuliah;?></td>
		<td><?php echo $row->jumlah_sks;?></td>
		<td><?php echo $row->syarat_semester;?></td>
		<td><?php echo $row->syarat_mata_kuliah;?></td>
		<td><?php echo $row->syarat_jumlah_sks;?></td>
		<td><?php echo $row->wajib;?></td>
		
		</tr>
		<?php	
			
		}
		echo '
		<tr><td colspan="8" >
		<input type="submit" name="submit" value="Pilih" class="buttons">
		<input type="reset" name="reset" value="Reset" class="buttons">
		</td></tr>
		';
		
	}
	else
	{
	echo '<tr><td colspan="8">Belum ada mata kuliah</td></tr>';
	}
	?>
	</table>
</form>
